{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "cb54f958-9ea4-4839-8057-35ab963ac620",
   "metadata": {
    "collapsed": false,
    "execution": {
     "shell.execute_reply.end": "",
     "shell.execute_reply.started": "2023-03-10T03:41:36.076221Z",
     "to_execute": "2023-03-10T03:41:35.934Z"
    },
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'causal_inference.estimators.cfrnet'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[5], line 5\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39msys\u001b[39;00m\n\u001b[0;32m      3\u001b[0m sys\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39mappend(\u001b[39m'\u001b[39m\u001b[39m../\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[1;32m----> 5\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mcausal_inference\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mevaluation\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mupeval\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n\u001b[0;32m      6\u001b[0m df \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mDataFrame({\n\u001b[0;32m      7\u001b[0m     \u001b[39m\"\u001b[39m\u001b[39mTreatment\u001b[39m\u001b[39m\"\u001b[39m: [\u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m0\u001b[39m, \u001b[39m0\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m0\u001b[39m, \u001b[39m0\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m],\n\u001b[0;32m      8\u001b[0m     \u001b[39m\"\u001b[39m\u001b[39mOutcome\u001b[39m\u001b[39m\"\u001b[39m:   [\u001b[39m6\u001b[39m, \u001b[39m7\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m7\u001b[39m, \u001b[39m8\u001b[39m, \u001b[39m2\u001b[39m, \u001b[39m2\u001b[39m, \u001b[39m9\u001b[39m, \u001b[39m10\u001b[39m],\n\u001b[0;32m      9\u001b[0m     \u001b[39m\"\u001b[39m\u001b[39mUscore\u001b[39m\u001b[39m\"\u001b[39m:    [\u001b[39m0.8\u001b[39m, \u001b[39m0.7\u001b[39m, \u001b[39m0.8\u001b[39m, \u001b[39m0.7\u001b[39m, \u001b[39m0.6\u001b[39m, \u001b[39m0.5\u001b[39m, \u001b[39m0.6\u001b[39m, \u001b[39m0.5\u001b[39m, \u001b[39m0.6\u001b[39m, \u001b[39m0.5\u001b[39m]\n\u001b[0;32m     10\u001b[0m })\n\u001b[0;32m     11\u001b[0m upe \u001b[39m=\u001b[39m UpContEval(df)\n",
      "File \u001b[1;32mc:\\Users\\admin\\Desktop\\repos\\caublazer\\example\\..\\causal_inference\\__init__.py:1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mestimators\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n\u001b[0;32m      2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mevaluation\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n\u001b[0;32m      3\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mdatasets\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n",
      "File \u001b[1;32mc:\\Users\\admin\\Desktop\\repos\\caublazer\\example\\..\\causal_inference\\estimators\\__init__.py:1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mcfrnet\u001b[39;00m \u001b[39mimport\u001b[39;00m CfrNet_Estimator\n\u001b[0;32m      2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mcausal_forest\u001b[39;00m \u001b[39mimport\u001b[39;00m CausalForest\n\u001b[0;32m      3\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39m.\u001b[39;00m\u001b[39mGNN_based_learner\u001b[39;00m \u001b[39mimport\u001b[39;00m GNN_Estimator\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'causal_inference.estimators.cfrnet'"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import sys\n",
    "sys.path.append('../')\n",
    "\n",
    "from causal_inference.evaluation.upeval import *\n",
    "df = pd.DataFrame({\n",
    "    \"Treatment\": [1, 1, 0, 0, 1, 1, 0, 0, 1, 1],\n",
    "    \"Outcome\":   [6, 7, 1, 1, 7, 8, 2, 2, 9, 10],\n",
    "    \"Uscore\":    [0.8, 0.7, 0.8, 0.7, 0.6, 0.5, 0.6, 0.5, 0.6, 0.5]\n",
    "})\n",
    "upe = UpContEval(df)\n",
    "upq = UpContEvalQ(df, nquantiles = 3)\n",
    "print('auuc_score: ',upq.auuc_score())\n",
    "upq.plot_cumsums(\"cumsums.png\")\n",
    "upq.plot_quantiles(\"quantiles.png\", density = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a739a586-38e2-4574-8262-d7cd0a8302e7",
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0bca350a-c75d-4af6-afab-da3877ebf853",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
